<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<!-- Mirrored from www.wolfssl.com/wolfSSL/Docs-wolfmqtt-manual.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 17 Jan 2017 13:28:05 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="Generator" content="iWeb 3.0.4"/>
<meta name="iWeb-Build" content="local-build-20170103"/>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<meta name="viewport" content="width=770"/>
<title>wolfSSL - Docs | wolfMQTT Manual</title>
<link rel="stylesheet" type="text/css" media="screen,print" href="Docs-wolfmqtt-manual_files/Docs-wolfmqtt-manual.css"/>
<!--[if lt IE 8]><link rel='stylesheet' type='text/css' media='screen,print' href='Docs-wolfmqtt-manual_files/Docs-wolfmqtt-manualIE.css'/><![endif]-->
<!--[if gte IE 8]><link rel='stylesheet' type='text/css' media='screen,print' href='Media/IE8.css'/><![endif]-->
<script type="text/javascript" src="Scripts/iWebSite.js"></script>
<script type="text/javascript" src="Docs-wolfmqtt-manual_files/Docs-wolfmqtt-manual.js"></script>
<meta name="description" content="wolfMQTT Manual explains how to build and use the wolfMQTT Client Library."/><meta name="keywords" content="mqtt, mqtt ssl, embedded mqtt, mqtt client, java dtls, embedded ssl, ssl library, embedded web server, openssl alternative, openssl replacement, cyassl, stream ciphers ssl, aes-ni ssl, dtls, mysql ssl, portable ssl, ssl portable, portable tls, small openssl, smart grid, connected home, ecc, lightweight ssl, suite b, encryption security software, ssl inspection"/><meta name="robots" content="follow,index"/> <script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','../../www.google-analytics.com/analytics.js','ga');ga('create','UA-64826966-1','auto');ga('send','pageview');</script>
 
<script>//<![CDATA[
window.zEmbed||function(e,t){var n,o,d,i,s,a=[],r=document.createElement("iframe");window.zEmbed=function(){a.push(arguments)},window.zE=window.zE||window.zEmbed,r.src="javascript:false",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="display: none",d=document.getElementsByTagName("script"),d=d[d.length-1],d.parentNode.insertBefore(r,d),i=r.contentWindow,s=i.document;try{o=s}catch(c){n=document.domain,r.src='javascript:var d=document.open();d.domain="'+n+'";void(0);',o=s}o.open()._l=function(){var o=this.createElement("script");n&&(this.domain=n),o.id="js-iframe-async",o.src=e,this.t=+new Date,this.zendeskHost=t,this.zEQueue=a,this.body.appendChild(o)},o.write('<body onload="document._l();">'),o.close()}("../../assets.zendesk.com/embeddable_framework/main.js","wolfssl.zendesk.com");
//]]></script>
  </head>
<body style="background: rgb(255, 255, 255); margin: 0pt; " onload="onPageLoad();">
<div style="text-align: center; ">
<div style="margin-bottom: 20px; margin-left: auto; margin-right: auto; margin-top: 20px; overflow: hidden; position: relative; word-wrap: break-word;  background: rgb(255, 255, 255); text-align: left; width: 770px; " id="body_content">
<div style="float: left; margin-left: 0px; position: relative; width: 770px; z-index: 0; " id="nav_layer">
<div style="height: 0px; line-height: 0px; " class="bumper"> </div>
<div style="clear: both; height: 0px; line-height: 0px; " class="spacer"> </div>
</div>
<div style="float: left; height: 0px; line-height: 0px; margin-left: 0px; position: relative; width: 770px; z-index: 10; " id="header_layer">
<div style="height: 0px; line-height: 0px; " class="bumper"> </div>
</div>
<div style="margin-left: 0px; position: relative; width: 770px; z-index: 5; " id="body_layer">
<div style="height: 0px; line-height: 0px; " class="bumper"> </div>
<div id="id1" style="height: 38px; left: 375px; position: absolute; top: 157px; width: 361px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_361_38" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style">wolfMQTT User Manual</p>
</div>
</div>
</div>
<div id="id2" style="height: 17384px; left: 35px; position: absolute; top: 246px; width: 701px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_701_17384" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-top: 0pt; " class="paragraph_style_1">Table of Contents<span class="style"><br/></span></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_3">Chapter 1:  Introduction<br/></p>
<p class="paragraph_style_4">        1.1      Protocol overview<br/></p>
<p class="paragraph_style_3">Chapter 2:  Building wolfSSL<br/></p>
<p class="paragraph_style_4">        2.1      Getting the Source Code<br/></p>
<p class="paragraph_style_4">        2.2      Building on *nix<br/></p>
<p class="paragraph_style_4">        2.3      Building on Windows<br/></p>
<p class="paragraph_style_4">        2.4      Building in a Non-Standard Environment<br/></p>
<p class="paragraph_style_4">        2.5      Cross Compiling<br/></p>
<p class="paragraph_style_4">        2.6      Install to Custom Directory<br/></p>
<p class="paragraph_style_3">Chapter 3:  Getting Started<br/></p>
<p class="paragraph_style_4">        3.1      Client Example<br/></p>
<p class="paragraph_style_4">        3.2      Firmware Update Example<br/></p>
<p class="paragraph_style_4">        3.3      Azure IoT Hub Example<br/></p>
<p class="paragraph_style_4">        3.4      AWS IoT Example<br/></p>
<p class="paragraph_style_3">Chapter 4:  Library Design<br/></p>
<p class="paragraph_style_4">        4.1      Example Design<br/></p>
<p class="paragraph_style_3">Chapter 5:  API Reference<br/></p>
<p class="paragraph_style_4">        5.1      MqttPacketResponseCodes (enum)<br/></p>
<p class="paragraph_style_4">        5.2      MqttClient_Init<br/></p>
<p class="paragraph_style_4">        5.3      MqttClient_Connect<br/></p>
<p class="paragraph_style_4">        5.4      MqttClient_Publish<br/></p>
<p class="paragraph_style_4">        5.5      MqttClient_Subscribe<br/></p>
<p class="paragraph_style_4">        5.6      MqttClient_Unsubscribe<br/></p>
<p class="paragraph_style_4">        5.7      MqttClient_Ping<br/></p>
<p class="paragraph_style_4">        5.8      MqttClient_Disconnect<br/></p>
<p class="paragraph_style_4">        5.9      MqttClient_WaitMessage<br/></p>
<p class="paragraph_style_4">        5.10    MqttClient_NetConnect<br/></p>
<p class="paragraph_style_4">        5.11    MqttClient_NetDisconnect<br/></p>
<p class="paragraph_style_4">        5.12    MqttClient_ReturnCodeToString<br/></p>
<p class="paragraph_style_3">Chapter 6:  License<br/></p>
<p class="paragraph_style_3">Chapter 7:  Support<br/></p>
<p class="paragraph_style_3">Chapter 8:  References<br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_1">Chapter 1: Introduction<br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_4">This is an implementation of the MQTT (Message Queuing Telemetry Transport) Client written in C. This library was built from the ground up to be multi-platform, space conscience and extensible. It supports all Packet Types, all Quality of Service (QoS) levels 0-2 and supports SSL/TLS using the wolfSSL library. This implementation is based on the MQTT v3.1.1 specification.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">1.1 Protocol Overview<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">MQTT is a lightweight open messaging protocol that was developed for constrained environments such as M2M (Machine to Machine) and IoT (Internet of Things), where a small code footprint is required. MQTT is based on the Pub/Sub messaging principle of publishing messages and subscribing to topics. The protocol efficiently packs messages to keep the overhead very low. The MQTT specification recommends TLS as a transport option to secure the protocol using port 8883 (secure-mqtt). Constrained devices can benefit from using TLS session resumption to reduce the reconnection cost.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">MQTT defines QoS levels 0-2 to specify the delivery integrity required.<br/></p>
<p class="paragraph_style_4">0 = At most once delivery: No acknowledgment.<br/></p>
<p class="paragraph_style_4">1 = At least once delivery: Sends acknowledgment (PUBLISH_ACK).<br/></p>
<p class="paragraph_style_4">2 = Exactly once delivery: Sends received (PUBLISH_REC), gets back released (PUBLISH_REL) and then sends complete (PUBLISH_COMP).<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_3">Highlights:<br/></p>
<ol>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>A publish message payload can be up to 256MB (28 bits). <br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>Packet header remaining length is encoded using a scheme where the most significant bit (7) indicates an additional length byte. <br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>Packets which require a response must include a 16-bit packet Id. This needs to be unique for any outstanding transactions. Typically an incremented value.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>A client can provide a last will and testament upon connect, which will be delivered when the broker sees the client has disconnected or network keep-alive has expired.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>The packet types are: CONNECT, CONNECT_ACK, PUBLISH, PUBLISH_ACK, PUBLISH_REC, PUBLISH_REL, PUBLISH_COMP, SUBSCRIBE, SUBSCRIBE_ACK, UNSUBSCRIBE, UNSUBSCRIBE_ACK, PING_REQ, PING_RESP and DISCONNECT.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>The connect packet contains the ASCII string “MQTT” to define the protocol name. This can be useful for wireshark/sniffing.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>Multiple topics can be subscribed or unsubscribed in the same packet request.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>Each subscription topic must define a QoS level. The QoS level is confirmed in the subscription acknowledgment.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>A publish message can be sent or received by either the client or the broker.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>Publish messages can be flagged for retention on the broker.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>A QoS level 2 requires two round-trips to complete the delivery exchange confirmation.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>Strings are UTF-8 encoded.<br/></p>
</li>
</ol>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">See <a title="http://mqtt.org/documentation" href="http://mqtt.org/documentation">http://mqtt.org/documentation</a> for additional MQTT documentation.<br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_1">Chapter 2: Building wolfMQTT<br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_4">wolfMQTT was written with portability in mind, and should generally be easy to build on most systems. If you have difficulty building, please don’t hesitate to seek support through our <span class="style_1">support forums</span> (<a title="http://www.wolfssl.com/forums" href="http://www.wolfssl.com/forums">http://www.wolfssl.com/forums</a>) or contact us directly at <a title="mailto:support@wolfssl.com" href="https://www.wolfssl.com/cdn-cgi/l/email-protection#9cefe9ececf3eee8dcebf3f0faefeff0b2fff3f1"><span class="__cf_email__" data-cfemail="42313732322d303602352d2e2431312e6c212d2f">[email&#160;protected]</span><script data-cfhash='f9e31' type="text/javascript">/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */</script></a>.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">This chapter explains how to build wolfMQTT on Unix and Windows, and provides guidance for building in a non-standard environment.  You will find a getting started guide and example client in<span class="style_1"> Chapter 3</span>.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">When using the autoconf / automake system to build, wolfMQTT uses a single Makefile to build all parts and examples of the library, which is both simpler and faster than using Makefiles recursively.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">If using the TLS features or the Firmware/Azure IoT Hub examples you’ll need to have wolfSSL installed. For wolfSSL and wolfMQTT we recommend using config options “./configure --enable-ecc --enable-supportedcurves --enable-base64encode”. For wolfSSL use “make &amp;&amp; sudo make install”. If you get an error locating the libwolfssl.so run “ldconfig” from the wolfSSL directory.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">2.1 Getting the Source Code<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">The most recent version can be downloaded from the GitHub website here:<br/></p>
<p class="paragraph_style_4"><a title="https://github.com/wolfSSL/wolfMQTT" href="https://github.com/wolfSSL/wolfMQTT">https://github.com/wolfSSL/wolfMQTT</a><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">Either click the “Download ZIP” button or use the command “git clone <a class="__cf_email__" href="https://www.wolfssl.com/cdn-cgi/l/email-protection" data-cfemail="41262835012628352934236f222e2c">[email&#160;protected]</a><script data-cfhash='f9e31' type="text/javascript">/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */</script>:wolfSSL/wolfMQTT.git”<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">2.2 Building on *nix<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">When building on Linux, *BSD, OS X, Solaris, or other *nix-like systems, use the autoconf system. To build wolfMQTT you only need to run three commands:<br/></p>
<p class="paragraph_style_4"> <br/></p>
<p class="paragraph_style_7">./configure<br/></p>
<p class="paragraph_style_7">make<br/></p>
<p class="paragraph_style_4"> <br/></p>
<p class="paragraph_style_4">You can append any number of build options to ./configure.  For a list of available build options run:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">./configure --help<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">from the command line to see a list of possible options to pass to the ./configure script.  To build wolfMQTT, run:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">make<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">To install wolfMQTT run:<br/></p>
<p class="paragraph_style_4"> <br/></p>
<p class="paragraph_style_7">make install<br/></p>
<p class="paragraph_style_4"> <br/></p>
<p class="paragraph_style_4">You may need superuser privileges to install, in which case precede the command with sudo:<br/></p>
<p class="paragraph_style_4"> <br/></p>
<p class="paragraph_style_7">sudo make install<br/></p>
<p class="paragraph_style_4"> <br/></p>
<p class="paragraph_style_4">To test the build, run the testsuite program from the root wolfMQTT source directory:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">./examples/mqttclient/mqttclient<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">If you want to build only the wolfMQTT library and not the additional items (examples), you can run the following command from the wolfMQTT root directory:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">make src/libwolfmqtt.la<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">2.3 Building on Windows<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><span class="style_1">Visual Studio 2015</span>: The wolfmqtt.sln solution is included for Visual Studio 2015 in the root directory of the install.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">To test each build, choose “Build All” from the Visual Studio menu and then run the mqttclient program.  To edit build options in the Visual Studio project, select your desired project (wolfmqtt, mqttclient) and browse to the “Properties” panel.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">For instructions on building the required wolfssl.dll see <a title="https://www.wolfssl.com/wolfSSL/Docs-wolfssl-visual-studio.html" href="Docs-wolfssl-visual-studio.html">https://www.wolfssl.com/wolfSSL/Docs-wolfssl-visual-studio.html</a>. When done copy the “wolfssl.dll” and “wolfssl.lib” into the wolfMQTT root. The project also assumes the wolfSSL headers are located “../wolfssl/”.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><span class="style_1">Cygwin</span>:  If using Cygwin, or other toolsets for Windows that provides *nix-like commands and functionality, please follow the instructions in section 2.2, above, for “Building on *nix”.  If building wolfMQTT for Windows on a Windows development machine, we recommend using the included Visual Studio project files to build wolfMQTT.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">2.4 Building in a non-standard environment<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">While not officially supported, we try to help users wishing to build wolfMQTT in a non-standard environment, particularly with embedded and cross-compilation systems. Below are some notes on getting started with this.<br/></p>
<p class="paragraph_style_4"> <br/></p>
<ol>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width" value="1">
<p style="text-indent: -15px; " class="paragraph_style_8"><span style="font-size: 12px; " class="Bullet">1.</span><span style="width: 5px; " class="inline-block"></span>The source and header files need to remain in the same directory structure as they are in the wolfMQTT download package.<br/></p>
</li>
</ol>
<p class="paragraph_style_4"><br/></p>
<ol>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width" value="2">
<p style="text-indent: -15px; " class="paragraph_style_8"><span style="font-size: 12px; " class="Bullet">2.</span><span style="width: 5px; " class="inline-block"></span>Some build systems will want to explicitly know where the wolfMQTT header files are located, so you may need to specify that.  They are located in the &lt;wolfmqtt_root&gt;/wolfmqtt directory.  Typically, you can add the &lt;wolfmqtt_root&gt; directory to your include path to resolve header problems.<br/></p>
</li>
</ol>
<p class="paragraph_style_4"><br/></p>
<ol>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width" value="3">
<p style="text-indent: -15px; " class="paragraph_style_8"><span style="font-size: 12px; " class="Bullet">3.</span><span style="width: 5px; " class="inline-block"></span>wolfMQTT defaults to a little endian system unless the configure process detects big endian.  Since users building in a non-standard environment aren't using the configure process, <span class="style_1">BIG_ENDIAN_ORDER</span> will need to be defined if using a big endian system.<br/></p>
</li>
</ol>
<p class="paragraph_style_4"><br/></p>
<ol>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width" value="4">
<p style="text-indent: -15px; " class="paragraph_style_8"><span style="font-size: 12px; " class="Bullet">4.</span><span style="width: 5px; " class="inline-block"></span>Try to build the library, and let us know if you run into any problems. If you need help, contact us at <a title="mailto:support@wolfssl.com" href="https://www.wolfssl.com/cdn-cgi/l/email-protection#37444247475845437740585b5144445b1954585a"><span class="__cf_email__" data-cfemail="0e7d7b7e7e617c7a4e796162687d7d62206d6163">[email&#160;protected]</span><script data-cfhash='f9e31' type="text/javascript">/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */</script></a>.<br/></p>
</li>
</ol>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">2.5 Cross Compiling<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">Many users on embedded platforms cross compile for their environment.  The easiest way to cross compile the library is to use the ./configure system.  It will generate a Makefile which can then be used to build wolfMQTT.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">When cross compiling, you’ll need to specify the host to ./configure, such as:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">./configure --host=arm-linux<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">You may also need to specify the compiler, linker, etc. that you want to use:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">./configure --host=arm-linux CC=arm-linux-gcc AR=arm-linux-ar RANLIB=arm-linux<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">After correctly configuring wolfMQTT for cross-compilation, you should be able to follow standard autoconf practices for building and installing the library:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">make<br/></p>
<p class="paragraph_style_7">sudo make install<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">If you have any additional tips or feedback about cross compiling wolfMQTT, please let us know at <a title="mailto:info@wolfssl.com" href="https://www.wolfssl.com/cdn-cgi/l/email-protection#046d6a626b44736b68627777682a676b69"><span class="__cf_email__" data-cfemail="2841464e47685f47444e5b5b44064b4745">[email&#160;protected]</span><script data-cfhash='f9e31' type="text/javascript">/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */</script></a>.<br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_5">2.6 Install to Custom Directory<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">To setup a custom install directory for wolfSSL use the following:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">In wolfSSL:<br/></p>
<p class="paragraph_style_4">1. ./configure --prefix=~/wolfssl<br/></p>
<p class="paragraph_style_4">2. make<br/></p>
<p class="paragraph_style_4">3. make install<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">This will place the libs in ~/wolfssl/lib and includes in ~/wolfssl/include<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">To setup a custom install directory for wolfMQTT and specify custom wolfSSL lib/include directories use the following:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">In wolfMQTT:<br/></p>
<p class="paragraph_style_4">1. ./configure --prefix=~/wolfmqtt --libdir=~/wolfssl/lib --includedir=~/wolfssl/include<br/></p>
<p class="paragraph_style_4">2. make<br/></p>
<p class="paragraph_style_4">3. make install<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">Make sure the paths above match your actual location.<br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_1">Chapter 3: Getting Started<br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_4">Here are the steps for creating your own implementation:<br/></p>
<p class="paragraph_style_4"><br/></p>
<ol>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width" value="1">
<p style="text-indent: -15px; " class="paragraph_style_8"><span style="font-size: 12px; " class="Bullet">1.</span><span style="width: 5px; " class="inline-block"></span>Create network callback functions for Connect, Read, Write and Disconnect. See `examples/mqttnet.c` and `examples/mqttnet.h` for reference implementation.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width" value="2">
<p style="text-indent: -15px; " class="paragraph_style_8"><span style="font-size: 12px; " class="Bullet">2.</span><span style="width: 5px; " class="inline-block"></span>Define the network callback functions and context in a `MqttNet` structure.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width" value="3">
<p style="text-indent: -15px; " class="paragraph_style_8"><span style="font-size: 12px; " class="Bullet">3.</span><span style="width: 5px; " class="inline-block"></span>Call `MqttClient_Init` passing in a `MqttClient` structure pointer, `MqttNet` structure pointer, `MqttMsgCb` function callback pointer, TX/RX buffers with maximum length and command timeout.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width" value="4">
<p style="text-indent: -15px; " class="paragraph_style_8"><span style="font-size: 12px; " class="Bullet">4.</span><span style="width: 5px; " class="inline-block"></span>Call `MqttClient_NetConnect` to connect to broker over network. If `use_tls` is non-zero value then it will perform a TLS connection. The TLS callback `MqttTlsCb` should be defined for WolfSSL certificate configuration.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width" value="5">
<p style="text-indent: -15px; " class="paragraph_style_8"><span style="font-size: 12px; " class="Bullet">5.</span><span style="width: 5px; " class="inline-block"></span>Call `MqttClient_Connect` passing pointer to `MqttConnect` structure to send MQTT connect command and wait for Connect Ack.<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width" value="6">
<p style="text-indent: -15px; " class="paragraph_style_8"><span style="font-size: 12px; " class="Bullet">6.</span><span style="width: 5px; " class="inline-block"></span>Call `MqttClient_Subscribe` passing pointer to `MqttSubscribe` structure to send MQTT Subscribe command and wait for Subscribe Ack (depending on QoS level).<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width" value="7">
<p style="text-indent: -15px; " class="paragraph_style_8"><span style="font-size: 12px; " class="Bullet">7.</span><span style="width: 5px; " class="inline-block"></span>Call `MqttClient_WaitMessage` passing pointer to `MqttMessage` to wait for incoming MQTT Publish message.<br/></p>
</li>
</ol>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">3.1 Client Example<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">The example MQTT client is located in /examples/mqttclient/. This example exercises all exposed API’s and prints any incoming publish messages for subscription topic “wolfMQTT/example/testTopic”.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_3">Usage<br/></p>
<p class="paragraph_style_7">./examples/mqttclient/mqttclient -?<br/></p>
<p class="paragraph_style_7">mqttclient:<br/></p>
<p class="paragraph_style_7">-? Help, print this usage<br/></p>
<p class="paragraph_style_7">-h &lt;host&gt;Host to connect to, default iot.eclipse.org<br/></p>
<p class="paragraph_style_7">-p &lt;num&gt;Port to connect on, default: Normal 1883, TLS 8883<br/></p>
<p class="paragraph_style_7">-t Enable TLS<br/></p>
<p class="paragraph_style_7">-c &lt;file&gt;Use provided certificate file<br/></p>
<p class="paragraph_style_7">-q &lt;num&gt;Qos Level 0-2, default 0<br/></p>
<p class="paragraph_style_7">-s Disable clean session connect flag<br/></p>
<p class="paragraph_style_7">-k &lt;num&gt;Keep alive seconds, default 60<br/></p>
<p class="paragraph_style_7">-i &lt;id&gt;Client Id, default WolfMQTTClient<br/></p>
<p class="paragraph_style_7">-l Enable LWT (Last Will and Testament)<br/></p>
<p class="paragraph_style_7">-u &lt;str&gt;Username<br/></p>
<p class="paragraph_style_7">-w &lt;str&gt;Password<br/></p>
<p class="paragraph_style_7">-n &lt;str&gt;Topic name, default wolfMQTT/example/testTopic<br/></p>
<p class="paragraph_style_7">-rSet Retain flag on publish message<br/></p>
<p class="paragraph_style_7">-C &lt;num&gt;Command Timeout, default 30000ms<br/></p>
<p class="paragraph_style_7">-TTest mode<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_3">Output (no TLS)<br/></p>
<p class="paragraph_style_3"><br/></p>
<p class="paragraph_style_7">./examples/mqttclient/mqttclient<br/></p>
<p class="paragraph_style_7">MQTT Client: QoS 0<br/></p>
<p class="paragraph_style_7">MQTT Net Init: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Init: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Socket Connect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Connect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Connect Ack: Return Code 0, Session Present 0<br/></p>
<p class="paragraph_style_7">MQTT Subscribe: Success (0)<br/></p>
<p class="paragraph_style_7">  Topic wolfMQTT/example/testTopic, Qos 0, Return Code 0<br/></p>
<p class="paragraph_style_7">MQTT Publish: Topic wolfMQTT/example/testTopic, Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Waiting for message...<br/></p>
<p class="paragraph_style_7">MQTT Message: Topic wolfMQTT/example/testTopic, Qos 0, Len 4<br/></p>
<p class="paragraph_style_7">Payload (0 - 4): test<br/></p>
<p class="paragraph_style_7">MQTT Message: Done<br/></p>
<p class="paragraph_style_7">asdf<br/></p>
<p class="paragraph_style_7">MQTT Publish: Topic wolfMQTT/example/testTopic, Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Message: Topic wolfMQTT/example/testTopic, Qos 0, Len 1<br/></p>
<p class="paragraph_style_7">Payload (0 - 1): asdf<br/></p>
<p class="paragraph_style_7">MQTT Message: Done<br/></p>
<p class="paragraph_style_7">^CReceived SIGINT<br/></p>
<p class="paragraph_style_7">MQTT Unsubscribe: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Disconnect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Socket Disconnect: Success (0)<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_3">Output (with TLS - peer has self signed cert)<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">./examples/mqttclient/mqttclient -t<br/></p>
<p class="paragraph_style_7">MQTT Client: QoS 0<br/></p>
<p class="paragraph_style_7">MQTT Net Init: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Init: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT TLS Setup (1)<br/></p>
<p class="paragraph_style_7">MQTT TLS Verify Callback:<br/></p>
<p class="paragraph_style_7">  PreVerify 0, Error -188 (ASN no signer error to confirm failure)<br/></p>
<p class="paragraph_style_7">  Subject's domain name is iot.eclipse.org<br/></p>
<p class="paragraph_style_7">  Allowing cert anyways<br/></p>
<p class="paragraph_style_7">MQTT Socket Connect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Connect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Connect Ack: Return Code 0, Session Present 0<br/></p>
<p class="paragraph_style_7">MQTT Subscribe: Success (0)<br/></p>
<p class="paragraph_style_7">  Topic wolfMQTT/example/testTopic, Qos 0, Return Code 0<br/></p>
<p class="paragraph_style_7">MQTT Publish: Topic wolfMQTT/example/testTopic, Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Waiting for message...<br/></p>
<p class="paragraph_style_7">MQTT Message: Topic wolfMQTT/example/testTopic, Qos 0, Len 4<br/></p>
<p class="paragraph_style_7">Payload (0 - 4): test<br/></p>
<p class="paragraph_style_7">MQTT Message: Done<br/></p>
<p class="paragraph_style_7">asdf<br/></p>
<p class="paragraph_style_7">MQTT Publish: Topic wolfMQTT/example/testTopic, Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Message: Topic wolfMQTT/example/testTopic, Qos 0, Len 1<br/></p>
<p class="paragraph_style_7">Payload (0 - 1):  asdf<br/></p>
<p class="paragraph_style_7">MQTT Message: Done<br/></p>
<p class="paragraph_style_7">^CReceived SIGINT<br/></p>
<p class="paragraph_style_7">MQTT Unsubscribe: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Disconnect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Socket Disconnect: Success (0)<br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_5">3.2 Firmware Update Example<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">The MQTT firmware update  is located in /examples/firmware/. This example has two parts. The first is called “fwpush”, which publishes a signed firmware image. The second is called “fwclient”, which receives the firmware image and verifies the signature. This example publishes message on the topic “wolfMQTT/example/firmware”.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_3">Usage<br/></p>
<p class="paragraph_style_7">./examples/firmware/fwpush -?<br/></p>
<p class="paragraph_style_7">fwpush:<br/></p>
<p class="paragraph_style_7">-?Help, print this usage<br/></p>
<p class="paragraph_style_7">-h &lt;host&gt;Host to connect to, default iot.eclipse.org<br/></p>
<p class="paragraph_style_7">-p &lt;num&gt;Port to connect on, default: Normal 1883, TLS 8883<br/></p>
<p class="paragraph_style_7">-tEnable TLS<br/></p>
<p class="paragraph_style_7">-c &lt;file&gt;Use provided certificate file<br/></p>
<p class="paragraph_style_7">-q &lt;num&gt; Qos Level 0-2, default 0<br/></p>
<p class="paragraph_style_7">-sDisable clean session connect flag<br/></p>
<p class="paragraph_style_7">-k &lt;num&gt;Keep alive seconds, default 60<br/></p>
<p class="paragraph_style_7">-i &lt;id&gt;Client Id, default WolfMQTTFwPush<br/></p>
<p class="paragraph_style_7">-lEnable LWT (Last Will and Testament)<br/></p>
<p class="paragraph_style_7">-u &lt;str&gt;Username<br/></p>
<p class="paragraph_style_7">-w &lt;str&gt;Password<br/></p>
<p class="paragraph_style_7">-n &lt;str&gt;Topic name, default wolfMQTT/example/firmware<br/></p>
<p class="paragraph_style_7">-rSet Retain flag on firmware publish message<br/></p>
<p class="paragraph_style_7">-C &lt;num&gt;Command Timeout, default 30000ms<br/></p>
<p class="paragraph_style_7">-TTest mode<br/></p>
<p class="paragraph_style_7">-f &lt;file&gt;   Use file for publish, default README.md<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_3">fwpush output:<br/></p>
<p class="paragraph_style_7">./examples/firmware/fwpush -t -f README.md <br/></p>
<p class="paragraph_style_7">MQTT Firmware Push Client: QoS 2<br/></p>
<p class="paragraph_style_7">Firmware Message: Sig 74 bytes, Key 65 bytes, File 4271 bytes<br/></p>
<p class="paragraph_style_7">MQTT Net Init: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Init: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT TLS Setup (1)<br/></p>
<p class="paragraph_style_7">MQTT TLS Verify Callback: PreVerify 0, <br/></p>
<p class="paragraph_style_7">  Error -188 (ASN no signer error to confirm failure)<br/></p>
<p class="paragraph_style_7">  Subject's domain name is iot.eclipse.org<br/></p>
<p class="paragraph_style_7">  Allowing cert anyways<br/></p>
<p class="paragraph_style_7">MQTT Socket Connect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Connect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Connect Ack: Return Code 0, Session Present 0<br/></p>
<p class="paragraph_style_7">MQTT Publish: Topic wolfMQTT/example/firmware, Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Disconnect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Socket Disconnect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Net DeInit: Success (0)<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_3">fwclient output:<br/></p>
<p class="paragraph_style_7">./examples/firmware/fwclient -t -f README.md <br/></p>
<p class="paragraph_style_7">MQTT Firmware Client: QoS 2<br/></p>
<p class="paragraph_style_7">MQTT Net Init: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Init: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT TLS Setup (1)<br/></p>
<p class="paragraph_style_7">MQTT TLS Verify Callback: PreVerify 0, <br/></p>
<p class="paragraph_style_7">  Error -188 (ASN no signer error to confirm failure)<br/></p>
<p class="paragraph_style_7">  Subject's domain name is iot.eclipse.org<br/></p>
<p class="paragraph_style_7">  Allowing cert anyways<br/></p>
<p class="paragraph_style_7">MQTT Socket Connect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Connect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Connect Ack: Return Code 0, Session Present 0<br/></p>
<p class="paragraph_style_7">MQTT Subscribe: Success (0)<br/></p>
<p class="paragraph_style_7">  Topic wolfMQTT/example/firmware, Qos 2, Return Code 2<br/></p>
<p class="paragraph_style_7">MQTT Waiting for message...<br/></p>
<p class="paragraph_style_7">MQTT Firmware Message: Qos 2, Len 4415<br/></p>
<p class="paragraph_style_7">Firmware Signature Verification: Pass (0)<br/></p>
<p class="paragraph_style_7">Saved 4271 bytes to README.md<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">^CReceived SIGINT<br/></p>
<p class="paragraph_style_7">MqttSocket_NetRead: Error 0<br/></p>
<p class="paragraph_style_7">MQTT Message Wait: Error (Network) (-8)<br/></p>
<p class="paragraph_style_7">MQTT Disconnect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Socket Disconnect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Net DeInit: Success (0)<br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_5">3.3 Azure IoT Hub Example<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">We setup a wolfMQTT IoT Hub on the Azure server for testing. We added a device called `demoDevice`, which you can connect and publish to. The example demonstrates creation of a SasToken, which is used as the password for the MQTT connect packet. It also shows the topic names for publishing events and listening to `devicebound` messages. This example only works with `ENABLE_MQTT_TLS` set and the wolfSSL library present because it requires Base64 Encode/Decode and HMAC-SHA256. Note: The wolfSSL library must be built with `./configure --enable-base64encode` or `#define WOLFSSL_BASE64_ENCODE`. The `wc_GetTime` API was added in 3.9.1 and if not present you'll need to implement your own version of this to get current UTC seconds or update your wolfSSL library.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_3">Usage<br/></p>
<p class="paragraph_style_7">./examples/azure/azureiothub -?<br/></p>
<p class="paragraph_style_7">azureiothub:<br/></p>
<p class="paragraph_style_7">-?Help, print this usage<br/></p>
<p class="paragraph_style_7">-h &lt;host&gt;Host to connect to, default wolfMQTT.azure-devices.net<br/></p>
<p class="paragraph_style_7">-p &lt;num&gt;Port to connect on, default: Normal 1883, TLS 8883<br/></p>
<p class="paragraph_style_7">-tEnable TLS<br/></p>
<p class="paragraph_style_7">-c &lt;file&gt;Use provided certificate file<br/></p>
<p class="paragraph_style_7">-q &lt;num&gt;Qos Level 0-2, default 1<br/></p>
<p class="paragraph_style_7">-sDisable clean session connect flag<br/></p>
<p class="paragraph_style_7">-k &lt;num&gt;Keep alive seconds, default 60<br/></p>
<p class="paragraph_style_7">-i &lt;id&gt;Client Id, default demoDevice<br/></p>
<p class="paragraph_style_7">-lEnable LWT (Last Will and Testament)<br/></p>
<p class="paragraph_style_7">-u &lt;str&gt;Username<br/></p>
<p class="paragraph_style_7">-w &lt;str&gt;Password<br/></p>
<p class="paragraph_style_7">-n &lt;str&gt;Topic name, default devices/demoDevice/messages/devicebound/#<br/></p>
<p class="paragraph_style_7">-rSet Retain flag on publish message<br/></p>
<p class="paragraph_style_7">-C &lt;num&gt;Command Timeout, default 30000ms<br/></p>
<p class="paragraph_style_7">-TTest mode<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_3">azureiothub output:<br/></p>
<p class="paragraph_style_7">./examples/azure/azureiothub<br/></p>
<p class="paragraph_style_7">AzureIoTHub Client: QoS 1, Use TLS 1<br/></p>
<p class="paragraph_style_7">MQTT Net Init: Success (0)<br/></p>
<p class="paragraph_style_7">SharedAccessSignature sr=wolfMQTT.azure-devices.net%2fdevices%2fdemoDevice&amp;sig=iy8al9ZPBLLZdMT38SIGy8Qx7k5jY%2f5nTpBo8Mw84PA%3d&amp;se=1482274308<br/></p>
<p class="paragraph_style_7">MQTT Init: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT TLS Setup (1)<br/></p>
<p class="paragraph_style_7">MQTT TLS Verify Callback: PreVerify 0, Error -188 (ASN no signer error to confirm failure)<br/></p>
<p class="paragraph_style_7">  Subject's domain name is *.azure-devices.net<br/></p>
<p class="paragraph_style_7">  Allowing cert anyways<br/></p>
<p class="paragraph_style_7">MQTT Socket Connect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Connect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Connect Ack: Return Code 0, Session Present 0<br/></p>
<p class="paragraph_style_7">MQTT Subscribe: Success (0)<br/></p>
<p class="paragraph_style_7">  Topic devices/demoDevice/messages/devicebound/#, Qos 1, Return Code 1<br/></p>
<p class="paragraph_style_7">MQTT Publish: Topic devices/demoDevice/messages/events/, Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Waiting for message...<br/></p>
<p class="paragraph_style_7">^CReceived SIGINT<br/></p>
<p class="paragraph_style_7">MQTT Exiting...<br/></p>
<p class="paragraph_style_7">MQTT Disconnect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Socket Disconnect: Success (0)<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">3.4 AWS IoT Example<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">We setup an AWS IoT endpoint and testing device certificate for testing. The AWS server uses TLS client certificate for authentication. The example is located in /examples/aws/. The example subscribes to `$aws/things/&quot;AWSIOT_DEVICE_ID&quot;/shadow/update/delta` and publishes to `$aws/things/&quot;AWSIOT_DEVICE_ID&quot;/shadow/update`. The AWS IoT broker requires TLS and only supports QoS levels 0-1.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_3">Usage<br/></p>
<p class="paragraph_style_7">./examples/aws/awsiot -?<br/></p>
<p class="paragraph_style_7">awsiot:<br/></p>
<p class="paragraph_style_7">-?Help, print this usage<br/></p>
<p class="paragraph_style_7">-h &lt;host&gt;Host to connect to, default a2dujmi05ideo2.iot.us-west-2.amazonaws.com<br/></p>
<p class="paragraph_style_7">-p &lt;num&gt;Port to connect on, default: Normal 1883, TLS 8883<br/></p>
<p class="paragraph_style_7">-tEnable TLS<br/></p>
<p class="paragraph_style_7">-c &lt;file&gt;Use provided certificate file<br/></p>
<p class="paragraph_style_7">-q &lt;num&gt;Qos Level 0-2, default 1<br/></p>
<p class="paragraph_style_7">-sDisable clean session connect flag<br/></p>
<p class="paragraph_style_7">-k &lt;num&gt;Keep alive seconds, default 60<br/></p>
<p class="paragraph_style_7">-i &lt;id&gt;Client Id, default demoDevice<br/></p>
<p class="paragraph_style_7">-lEnable LWT (Last Will and Testament)<br/></p>
<p class="paragraph_style_7">-u &lt;str&gt;Username<br/></p>
<p class="paragraph_style_7">-w &lt;str&gt;Password<br/></p>
<p class="paragraph_style_7">-n &lt;str&gt;Topic name, default $aws/things/demoDevice/shadow/update/delta<br/></p>
<p class="paragraph_style_7">-rSet Retain flag on publish message<br/></p>
<p class="paragraph_style_7">-C &lt;num&gt;Command Timeout, default 30000ms<br/></p>
<p class="paragraph_style_7">-TTest mode<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_3">awsiot output:<br/></p>
<p class="paragraph_style_7">./examples/aws/awsiot<br/></p>
<p class="paragraph_style_7">AwsIoT Client: QoS 1, Use TLS 1<br/></p>
<p class="paragraph_style_7">MQTT Net Init: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Init: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT TLS Setup (1)<br/></p>
<p class="paragraph_style_7">MQTT Socket Connect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Connect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Connect Ack: Return Code 0, Session Present 0<br/></p>
<p class="paragraph_style_7">MQTT Subscribe: Success (0)<br/></p>
<p class="paragraph_style_7">  Topic $aws/things/demoDevice/shadow/update/delta, Qos 1, Return Code 1<br/></p>
<p class="paragraph_style_7">MQTT Publish: Topic $aws/things/demoDevice/shadow/update, Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Waiting for message...<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">^CReceived SIGINT<br/></p>
<p class="paragraph_style_7">MQTT Exiting...<br/></p>
<p class="paragraph_style_7">MQTT Disconnect: Success (0)<br/></p>
<p class="paragraph_style_7">MQTT Socket Disconnect: Success (0)<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_1">Chapter 4: Library Design<br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_4">Library header files are located in the /wolfmqtt directory. Only the /wolfmqtt/mqtt_client.h header is required to be included:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">#include &lt;wolfmqtt/mqtt_client.h&gt;<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">The library has three components:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_3">1. mqtt_client<br/></p>
<p class="paragraph_style_4">This is where the top level application interfaces for the MQTT client reside. If the API performs a network write it will block on a network read if an acknowledgment is expected.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_3">2. mqtt_packet<br/></p>
<p class="paragraph_style_4">This is where all the packet encoding/decoding is handled. This contains the MQTT Packet structures for:<br/></p>
<p class="paragraph_style_4"><br/></p>
<ol>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>Connect: `MqttConnect`<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>Publish / Message: `MqttPublish` / `MqttMessage` (they are the same)<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>Subscribe: `MqttSubscribe`<br/></p>
</li>
<li style="line-height: 15px; padding-left: 30px; text-indent: -15px; " class="full-width">
<p style="text-indent: -15px; " class="paragraph_style_6"><span style="font-size: 12px; " class="Bullet">•</span><span style="width: 11px; " class="inline-block"></span>Unsubscribe: `MqttUnsubscribe`<br/></p>
</li>
</ol>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_3">3. mqtt_socket<br/></p>
<p class="paragraph_style_4">This is where the transport socket optionally wraps TLS and uses the `MqttNet` callbacks for the platform specific network handling. This contains the MQTT Network structure `MqttNet` for network callback and context.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">4.1 Example Design<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">The examples use a common “examples/mqttnet.c” to handle the network callbacks on the clients. This reference supports Linux (BSD sockets), FreeRTOS/LWIP, MQX RTCS, Harmony and Windows.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_1">Chapter 5: API Reference<span class="style"><br/></span></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_4">This describes the public application interfaces for the wolfMQTT library.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5"><br/></p>
<p class="paragraph_style_5">5.1 MqttPacketResponseCodes (enum)<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">These are the API response codes:<br/></p>
<p class="paragraph_style_4">MQTT_CODE_SUCCESS = 0: Success<br/></p>
<p class="paragraph_style_4">MQTT_CODE_ERROR_BAD_ARG = -1: Invalid argument provided<br/></p>
<p class="paragraph_style_4">MQTT_CODE_ERROR_OUT_OF_BUFFER = -2: Rx or Tx buffer out of space<br/></p>
<p class="paragraph_style_4">MQTT_CODE_ERROR_MALFORMED_DATA = -3: Malformed packet remaining length<br/></p>
<p class="paragraph_style_4">MQTT_CODE_ERROR_PACKET_TYPE = -4: Invalid packet type in header<br/></p>
<p class="paragraph_style_4">MQTT_CODE_ERROR_PACKET_ID = -5: Packet Id mismatch<br/></p>
<p class="paragraph_style_4">MQTT_CODE_ERROR_TLS_CONNECT = -6: TLS connect error.<br/></p>
<p class="paragraph_style_4">MQTT_CODE_ERROR_TIMEOUT = -7: Net read/write/connect timeout<br/></p>
<p class="paragraph_style_4">MQTT_CODE_ERROR_NETWORK = -8: Network error<br/></p>
<p class="paragraph_style_4">MQTT_CODE_ERROR_MEMORY = -9: Memory error<br/></p>
<p class="paragraph_style_4">MQTT_CODE_ERROR_STAT = -10: State error<br/></p>
<p class="paragraph_style_4">MQTT_CODE_CONTINUE = -101: Non-blocking mode, perform IO and call again.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">5.2 MqttClient_Init<br/></p>
<p class="paragraph_style_5"><br/></p>
<div class="paragraph paragraph_style_4"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfmqtt-manual_files/shapeimage_1.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_9"><span class="style">Synopsis</span>:<br/></p>
<p class="paragraph_style_4">#include &lt;wolfmqtt/mqtt_client.h&gt;<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">typedef int (*MqttMsgCb)(struct _MqttClient *client, MqttMessage *message, byte is_new, byte is_done);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">int MqttClient_Init(<br/></p>
<p class="paragraph_style_4">        MqttClient *client, <br/></p>
<p class="paragraph_style_4">        MqttNet *net,<br/></p>
<p class="paragraph_style_4">        MqttMsgCb cb,<br/></p>
<p class="paragraph_style_4">        byte *tx_buf, int tx_buf_len,<br/></p>
<p class="paragraph_style_4">        byte *rx_buf, int rx_buf_len,<br/></p>
<p class="paragraph_style_4">        int cmd_timeout_ms);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Description:<br/></p>
<p class="paragraph_style_4">Initializes the wolfMQTT library for use.  Must be called once per application and before any other calls to the library.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Return Values:<br/></p>
<p class="paragraph_style_4">See MqttPacketResponseCodes in /wolfmqtt/mqtt_types.h<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_SUCCESS</span> - Success<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_ERROR_BAD_ARG</span> - Invalid argument provided<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Parameters:<br/></p>
<p class="paragraph_style_4"><span class="style_1">client</span> - Pointer to MqttClient structure (okay if not initialized).<br/></p>
<p class="paragraph_style_4"><span class="style_1">net</span> - Pointer to MqttNet structure populated with network callbacks and context.<br/></p>
<p class="paragraph_style_4"><span class="style_1">cb</span> - Pointer to MqttMsgCb callback function.<br/></p>
<p class="paragraph_style_4"><span class="style_1">tx_buf</span> - Pointer to transmit buffer used during encoding.<br/></p>
<p class="paragraph_style_4"><span class="style_1">tx_buf_len</span>  - Maximum length of the transmit buffer.<br/></p>
<p class="paragraph_style_4"><span class="style_1">rx_buf</span> - Pointer to receive buffer used during decoding.<br/></p>
<p class="paragraph_style_4"><span class="style_1">rx_buf_len</span>  - Maximum length of the receive buffer.<br/></p>
<p class="paragraph_style_4"><span class="style_1">connect_timeout_ms</span>  - Maximum command wait timeout in milliseconds.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Example:<br/></p>
<p class="paragraph_style_7">#define MAX_BUFFER_SIZE         1024<br/></p>
<p class="paragraph_style_7">#define DEFAULT_CMD_TIMEOUT_MS  1000<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">static int mqttclient_message_cb(MqttClient *client, MqttMessage *msg, byte msg_new, byte msg_done)<br/></p>
<p class="paragraph_style_7">{<br/></p>
<p class="paragraph_style_7">    if (msg_new) {<br/></p>
<p class="paragraph_style_7">        /* Message new */<br/></p>
<p class="paragraph_style_7">    }<br/></p>
<p class="paragraph_style_7">    if (msg_done) {<br/></p>
<p class="paragraph_style_7">        /* Message done */<br/></p>
<p class="paragraph_style_7">    }<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">    return MQTT_CODE_SUCCESS; <br/></p>
<p class="paragraph_style_7">    /* Return negative to terminate publish processing */<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">int rc = 0;<br/></p>
<p class="paragraph_style_7">MqttClient client;<br/></p>
<p class="paragraph_style_7">MqttNet net;<br/></p>
<p class="paragraph_style_7">byte *tx_buf = NULL, *rx_buf = NULL;<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">tx_buf = malloc(MAX_BUFFER_SIZE);<br/></p>
<p class="paragraph_style_7">rx_buf = malloc(MAX_BUFFER_SIZE);<br/></p>
<p class="paragraph_style_7">rc = MqttClient_Init(&amp;client, &amp;net, mqttclient_message_cb,<br/></p>
<p class="paragraph_style_7">    tx_buf, MAX_BUFFER_SIZE, rx_buf, MAX_BUFFER_SIZE,<br/></p>
<p class="paragraph_style_7">    DEFAULT_CMD_TIMEOUT_MS);<br/></p>
<p class="paragraph_style_7">if (rc != MQTT_CODE_SUCCESS) {<br/></p>
<p class="paragraph_style_7">    printf(&quot;MQTT Init: %s (%d)\n&quot;, MqttClient_ReturnCodeToString(rc), rc);<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">See Also:<br/></p>
<p class="paragraph_style_4">None<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">5.3 MqttClient_Connect<br/></p>
<p class="paragraph_style_5"><br/></p>
<div class="paragraph paragraph_style_4"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfmqtt-manual_files/shapeimage_2.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Synopsis:<br/></p>
<p class="paragraph_style_4">#include &lt;wolfmqtt/mqtt_client.h&gt;<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">int MqttClient_Connect(<br/></p>
<p class="paragraph_style_4">    MqttClient *client, <br/></p>
<p class="paragraph_style_4">    MqttConnect *connect);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Description:<br/></p>
<p class="paragraph_style_4">Encodes and sends the MQTT Connect packet and waits for the Connect Acknowledgement packet. This can block in MqttNet.read data unless non-blocking is enabled (WOLFMQTT_NONBLOCK) and MQTT_CODE_CONTINUE is returned.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Return Values:<br/></p>
<p class="paragraph_style_4">See MqttPacketResponseCodes in /wolfmqtt/mqtt_types.h<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_SUCCESS</span> - Success<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_CONTINUE</span> - Non-blocking mode, perform IO and call again.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Parameters:<br/></p>
<p class="paragraph_style_4"><span class="style_1">client</span> - Pointer to MqttClient structure already initialized using MqttClient_Init.<br/></p>
<p class="paragraph_style_4"><span class="style_1">connect</span> - Pointer to MqttConnect structure populated with connection options.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Example:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">int rc = 0;<br/></p>
<p class="paragraph_style_7">MqttClient client;<br/></p>
<p class="paragraph_style_7">MqttConnect connect;<br/></p>
<p class="paragraph_style_7">MqttMessage lwt_msg;<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">/* Define connect parameters */<br/></p>
<p class="paragraph_style_7">connect.keep_alive_sec = keep_alive_sec;<br/></p>
<p class="paragraph_style_7">connect.clean_session = clean_session;<br/></p>
<p class="paragraph_style_7">connect.client_id = client_id;<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">/* Last will and testament sent by broker to subscribers of topic when broker connection is lost */<br/></p>
<p class="paragraph_style_7">memset(&amp;lwt_msg, 0, sizeof(lwt_msg));<br/></p>
<p class="paragraph_style_7">connect.lwt_msg = &amp;lwt_msg;<br/></p>
<p class="paragraph_style_7">connect.enable_lwt = enable_lwt;<br/></p>
<p class="paragraph_style_7">if (enable_lwt) {<br/></p>
<p class="paragraph_style_7">lwt_msg.qos = qos;<br/></p>
<p class="paragraph_style_7">lwt_msg.retain = 0;<br/></p>
<p class="paragraph_style_7">lwt_msg.topic_name = &quot;lwttopic&quot;;<br/></p>
<p class="paragraph_style_7">lwt_msg.message = (byte*)DEFAULT_CLIENT_ID;<br/></p>
<p class="paragraph_style_7">lwt_msg.message_len = strlen(DEFAULT_CLIENT_ID);<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_7">/* Optional authentication */<br/></p>
<p class="paragraph_style_7">connect.username = username;<br/></p>
<p class="paragraph_style_7">connect.password = password;<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">/* Send Connect and wait for Connect Ack */<br/></p>
<p class="paragraph_style_7">rc = MqttClient_Connect(&amp;client, &amp;connect);<br/></p>
<p class="paragraph_style_7">if (rc != MQTT_CODE_SUCCESS) {<br/></p>
<p class="paragraph_style_7">    printf(&quot;MQTT Connect: %s (%d)\n&quot;, MqttClient_ReturnCodeToString(rc), rc);<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">See Also:<br/></p>
<p class="paragraph_style_4">MqttClient_Init<br/></p>
<p class="paragraph_style_4">MqttClient_Disconnect<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">5.4 MqttClient_Publish<br/></p>
<p class="paragraph_style_5"><br/></p>
<div class="paragraph paragraph_style_4"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfmqtt-manual_files/shapeimage_3.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Synopsis:<br/></p>
<p class="paragraph_style_4">#include &lt;wolfmqtt/mqtt_client.h&gt;<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">int MqttClient_Publish(<br/></p>
<p class="paragraph_style_4">    MqttClient *client, <br/></p>
<p class="paragraph_style_4">    MqttPublish *publish);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Description:<br/></p>
<p class="paragraph_style_4">Encodes and sends the MQTT Publish packet and waits for the Publish response (if QoS &gt; 0). This can block in MqttNet.read data unless non-blocking is enabled (WOLFMQTT_NONBLOCK) and MQTT_CODE_CONTINUE is returned.  If QoS level = 1 then will wait for PUBLISH_ACK. If QoS level = 2 then will wait for PUBLISH_REC then send PUBLISH_REL and wait for PUBLISH_COMP.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Return Values:<br/></p>
<p class="paragraph_style_4">See enum MqttPacketResponseCodes in /wolfmqtt/mqtt_types.h<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_SUCCESS</span> - success<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_CONTINUE</span> - Non-blocking mode, perform IO and call again.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Parameters:<br/></p>
<p class="paragraph_style_4"><span class="style_1">client</span> - Pointer to MqttClient structure already initialized using MqttClient_Init.<br/></p>
<p class="paragraph_style_4"><span class="style_1">publish</span> - Pointer to MqttPublish structure initialized with message data. Note: MqttPublish and MqttMessage are same structure.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Example:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">#define TEST_MESSAGE            &quot;test&quot; /* NULL */<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">int rc = 0;<br/></p>
<p class="paragraph_style_7">MqttPublish publish;<br/></p>
<p class="paragraph_style_7">word16 packet_id = 0;<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">/* Publish Topic */<br/></p>
<p class="paragraph_style_7">publish.retain = 0;<br/></p>
<p class="paragraph_style_7">publish.qos = qos;<br/></p>
<p class="paragraph_style_7">publish.duplicate = 0;<br/></p>
<p class="paragraph_style_7">publish.topic_name = &quot;pubtopic&quot;;<br/></p>
<p class="paragraph_style_7">publish.packet_id = ++packet_id;<br/></p>
<p class="paragraph_style_7">publish.message = (byte*)TEST_MESSAGE;<br/></p>
<p class="paragraph_style_7">publish.message_len = strlen(TEST_MESSAGE);<br/></p>
<p class="paragraph_style_7">rc = MqttClient_Publish(&amp;client, &amp;publish);<br/></p>
<p class="paragraph_style_7">if (rc != MQTT_CODE_SUCCESS) {<br/></p>
<p class="paragraph_style_7">    printf(&quot;MQTT Publish: %s (%d)\n&quot;, MqttClient_ReturnCodeToString(rc), rc);<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">See Also:<br/></p>
<p class="paragraph_style_4">MqttClient_Init<br/></p>
<p class="paragraph_style_4">MqttClient_Subscribe<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">5.5 MqttClient_Subscribe<br/></p>
<p class="paragraph_style_5"><br/></p>
<div class="paragraph paragraph_style_4"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfmqtt-manual_files/shapeimage_4.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Synopsis:<br/></p>
<p class="paragraph_style_4">#include &lt;wolfmqtt/mqtt_client.h&gt;<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">int MqttClient_Subscribe(<br/></p>
<p class="paragraph_style_4">    MqttClient *client, <br/></p>
<p class="paragraph_style_4">    MqttSubscribe *subscribe);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Description:<br/></p>
<p class="paragraph_style_4">Encodes and sends the MQTT Subscribe packet and waits for the Subscribe Acknowledgement packet. This can block in MqttNet.read data unless non-blocking is enabled (WOLFMQTT_NONBLOCK) and MQTT_CODE_CONTINUE is returned.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Return Values:<br/></p>
<p class="paragraph_style_4">See enum MqttPacketResponseCodes in /wolfmqtt/mqtt_types.h<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_SUCCESS</span> - Success<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_CONTINUE</span> - Non-blocking mode, perform IO and call again.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Parameters:<br/></p>
<p class="paragraph_style_4"><span class="style_1">client</span> - Pointer to MqttClient structure already initialized using MqttClient_Init.<br/></p>
<p class="paragraph_style_4"><span class="style_1">subscribe</span> - Pointer to MqttSubscribe structure initialized with subscription topic list and desired QoS.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Example:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">#define TEST_TOPIC_COUNT        2<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">int rc = 0;<br/></p>
<p class="paragraph_style_7">MqttSubscribe subscribe;<br/></p>
<p class="paragraph_style_7">MqttTopic topics[TEST_TOPIC_COUNT], *topic;<br/></p>
<p class="paragraph_style_7">word16 packet_id = 0;<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">/* Build list of topics */<br/></p>
<p class="paragraph_style_7">topics[0].topic_filter = &quot;subtopic1&quot;;<br/></p>
<p class="paragraph_style_7">topics[0].qos = qos;<br/></p>
<p class="paragraph_style_7">topics[1].topic_filter = &quot;subtopic2&quot;;<br/></p>
<p class="paragraph_style_7">topics[1].qos = qos;<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">/* Subscribe Topic */<br/></p>
<p class="paragraph_style_7">subscribe.packet_id = ++packet_id;<br/></p>
<p class="paragraph_style_7">subscribe.topic_count = TEST_TOPIC_COUNT;<br/></p>
<p class="paragraph_style_7">subscribe.topics = topics;<br/></p>
<p class="paragraph_style_7">rc = MqttClient_Subscribe(&amp;client, &amp;subscribe);<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">if (rc == MQTT_CODE_SUCCESS) {<br/></p>
<p class="paragraph_style_7">for (i = 0; i &lt; subscribe.topic_count; i++) {<br/></p>
<p class="paragraph_style_7">topic = &amp;subscribe.topics[i];<br/></p>
<p class="paragraph_style_7">printf(&quot;  Topic %s, Qos %u, Return Code %u\n&quot;,<br/></p>
<p class="paragraph_style_7">topic-&gt;topic_filter, topic-&gt;qos, topic-&gt;return_code);<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_7">else {<br/></p>
<p class="paragraph_style_7">    printf(&quot;MQTT Subscribe: %s (%d)\n&quot;, MqttClient_ReturnCodeToString(rc), rc);<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">See Also:<br/></p>
<p class="paragraph_style_4">MqttClient_Init<br/></p>
<p class="paragraph_style_4">MqttClient_Unsubscribe<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">5.6 MqttClient_Unsubscribe<br/></p>
<p class="paragraph_style_5"><br/></p>
<div class="paragraph paragraph_style_4"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfmqtt-manual_files/shapeimage_5.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Synopsis:<br/></p>
<p class="paragraph_style_4">#include &lt;wolfmqtt/mqtt_client.h&gt;<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">int MqttClient_Unsubscribe(<br/></p>
<p class="paragraph_style_4">    MqttClient *client, <br/></p>
<p class="paragraph_style_4">    MqttUnsubscribe *unsubscribe);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Description:<br/></p>
<p class="paragraph_style_4">Encodes and sends the MQTT Unsubscribe packet and waits for the Unsubscribe Acknowledgement packet. This can block in MqttNet.read data unless non-blocking is enabled (WOLFMQTT_NONBLOCK) and MQTT_CODE_CONTINUE is returned.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Return Values:<br/></p>
<p class="paragraph_style_4">See enum MqttPacketResponseCodes in /wolfmqtt/mqtt_types.h<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_SUCCESS</span> - Success<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_CONTINUE</span> - Non-blocking mode, perform IO and call again.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Parameters:<br/></p>
<p class="paragraph_style_4"><span class="style_1">client</span> - Pointer to MqttClient structure already initialized using MqttClient_Init.<br/></p>
<p class="paragraph_style_4"><span class="style_1">unsubscribe</span> - Pointer to MqttUnsubscribe structure initialized with topic list.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Example:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">#define TEST_TOPIC_COUNT        2<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">int rc = 0;<br/></p>
<p class="paragraph_style_7">MqttUnsubscribe unsubscribe;<br/></p>
<p class="paragraph_style_7">MqttTopic topics[TEST_TOPIC_COUNT], *topic;<br/></p>
<p class="paragraph_style_7">word16 packet_id = 0;<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">/* Build list of topics */<br/></p>
<p class="paragraph_style_7">topics[0].topic_filter = &quot;subtopic1&quot;;<br/></p>
<p class="paragraph_style_7">topics[1].topic_filter = &quot;subtopic2&quot;;<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">/* Unsubscribe Topics */<br/></p>
<p class="paragraph_style_7">unsubscribe.packet_id = ++packet_id;<br/></p>
<p class="paragraph_style_7">unsubscribe.topic_count = TEST_TOPIC_COUNT;<br/></p>
<p class="paragraph_style_7">unsubscribe.topics = topics;<br/></p>
<p class="paragraph_style_7">rc = MqttClient_Unsubscribe(&amp;client, &amp;unsubscribe);<br/></p>
<p class="paragraph_style_7">if (rc != MQTT_CODE_SUCCESS) {<br/></p>
<p class="paragraph_style_7">    printf(&quot;MQTT Unsubscribe: %s (%d)\n&quot;, MqttClient_ReturnCodeToString(rc), rc);<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">See Also:<br/></p>
<p class="paragraph_style_4">MqttClient_Init<br/></p>
<p class="paragraph_style_4">MqttClient_Subscribe<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">5.7 MqttClient_Ping<br/></p>
<p class="paragraph_style_5"><br/></p>
<div class="paragraph paragraph_style_4"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfmqtt-manual_files/shapeimage_6.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Synopsis:<br/></p>
<p class="paragraph_style_4">#include &lt;wolfmqtt/mqtt_client.h&gt;<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">int MqttClient_Ping(<br/></p>
<p class="paragraph_style_4">    MqttClient *client);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Description:<br/></p>
<p class="paragraph_style_4">Encodes and sends the MQTT Ping Request packet and waits for the Ping Response packet. This can block in MqttNet.read data unless non-blocking is enabled (WOLFMQTT_NONBLOCK) and MQTT_CODE_CONTINUE is returned.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Return Values:<br/></p>
<p class="paragraph_style_4">See enum MqttPacketResponseCodes in /wolfmqtt/mqtt_types.h<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_SUCCESS</span> - Success<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_CONTINUE</span> - Non-blocking mode, perform IO and call again.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Parameters:<br/></p>
<p class="paragraph_style_4"><span class="style_1">client</span> - Pointer to MqttClient structure already initialized using MqttClient_Init.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Example:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">/* Send Ping */<br/></p>
<p class="paragraph_style_7">int rc = MqttClient_Ping(&amp;client);<br/></p>
<p class="paragraph_style_7">if (rc != MQTT_CODE_SUCCESS) {<br/></p>
<p class="paragraph_style_7">    printf(&quot;MQTT Ping: %s (%d)\n&quot;, MqttClient_ReturnCodeToString(rc), rc);<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">See Also:<br/></p>
<p class="paragraph_style_4">MqttClient_Init<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">5.8 MqttClient_Disconnect<br/></p>
<p class="paragraph_style_5"><br/></p>
<div class="paragraph paragraph_style_4"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfmqtt-manual_files/shapeimage_7.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Synopsis:<br/></p>
<p class="paragraph_style_4">#include &lt;wolfmqtt/mqtt_client.h&gt;<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">int MqttClient_Disconnect(<br/></p>
<p class="paragraph_style_4">    MqttClient *client);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Description:<br/></p>
<p class="paragraph_style_4">Encodes and sends the MQTT Disconnect packet (no response).<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Return Values:<br/></p>
<p class="paragraph_style_4">See enum MqttPacketResponseCodes in /wolfmqtt/mqtt_types.h<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_SUCCESS</span> - Success<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_CONTINUE</span> - Non-blocking mode, perform IO and call again.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Parameters:<br/></p>
<p class="paragraph_style_4"><span class="style_1">client</span> - Pointer to MqttClient structure already initialized using MqttClient_Init.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Example:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">int rc = MqttClient_Disconnect(&amp;client);<br/></p>
<p class="paragraph_style_7">if (rc != MQTT_CODE_SUCCESS) {<br/></p>
<p class="paragraph_style_7">    printf(&quot;MQTT Disconnect: %s (%d)\n&quot;, MqttClient_ReturnCodeToString(rc),<br/></p>
<p class="paragraph_style_7">rc);<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">See Also:<br/></p>
<p class="paragraph_style_4">MqttClient_Init<br/></p>
<p class="paragraph_style_4">MqttClient_Connect<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">5.9 MqttClient_WaitMessage<br/></p>
<p class="paragraph_style_5"><br/></p>
<div class="paragraph paragraph_style_4"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfmqtt-manual_files/shapeimage_8.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Synopsis:<br/></p>
<p class="paragraph_style_4">#include &lt;wolfmqtt/mqtt_client.h&gt;<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">int MqttClient_WaitMessage(<br/></p>
<p class="paragraph_style_4">    MqttClient *client, <br/></p>
<p class="paragraph_style_4">    MqttMessage *message,<br/></p>
<p class="paragraph_style_4">    int timeout_ms);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Description:<br/></p>
<p class="paragraph_style_4">Waits for Publish packets to arrive. This can block in MqttNet.read data unless non-blocking is enabled (WOLFMQTT_NONBLOCK) and MQTT_CODE_CONTINUE is returned. If a timeout_ms provided it will be passed up to MqttNet.read which can be used for network select() with timeout or if non-blocking is enabled can return MQTT_CODE_CONTINUE.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Return Values:<br/></p>
<p class="paragraph_style_4">See enum MqttPacketResponseCodes in /wolfmqtt/mqtt_types.h<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_SUCCESS</span> - Success<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_CONTINUE</span> - Non-blocking mode, perform IO and call again.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Parameters:<br/></p>
<p class="paragraph_style_4"><span class="style_1">client</span> - Pointer to MqttClient structure already initialized using MqttClient_Init.<br/></p>
<p class="paragraph_style_4"><span class="style_1">message</span> - Pointer to MqttMessage structure (uninitialized is okay).<br/></p>
<p class="paragraph_style_4"><span class="style_1">timeout_ms</span> - Milliseconds until read timeout.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Example:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">#define DEFAULT_CMD_TIMEOUT_MS  1000<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">int rc = 0;<br/></p>
<p class="paragraph_style_7">MqttMessage msg;<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">/* Read Loop */<br/></p>
<p class="paragraph_style_7">while (mStopRead == 0) {<br/></p>
<p class="paragraph_style_7">    /* Try and read packet */<br/></p>
<p class="paragraph_style_7">    rc = MqttClient_WaitMessage(&amp;client, &amp;msg, DEFAULT_CMD_TIMEOUT_MS);<br/></p>
<p class="paragraph_style_7">    if (rc &gt;= 0) {<br/></p>
<p class="paragraph_style_7">        /* Print incoming message */<br/></p>
<p class="paragraph_style_7">        printf(&quot;MQTT Message: Topic %s, Len %u\n&quot;, msg.topic_name, msg.message_len);<br/></p>
<p class="paragraph_style_7">    }<br/></p>
<p class="paragraph_style_7">    else if (rc != MQTT_CODE_ERROR_TIMEOUT) {<br/></p>
<p class="paragraph_style_7">        /* There was an error */<br/></p>
<p class="paragraph_style_7">        printf(&quot;MQTT Message Wait: %s (%d)\n&quot;, MqttClient_ReturnCodeToString(rc), rc);<br/></p>
<p class="paragraph_style_7">        break;<br/></p>
<p class="paragraph_style_7">    }<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">See Also:<br/></p>
<p class="paragraph_style_4">MqttClient_Init<br/></p>
<p class="paragraph_style_4">MqttClient_Publish<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">5.10 MqttClient_NetConnect<br/></p>
<p class="paragraph_style_5"><br/></p>
<div class="paragraph paragraph_style_4"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfmqtt-manual_files/shapeimage_9.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Synopsis:<br/></p>
<p class="paragraph_style_4">#include &lt;wolfmqtt/mqtt_client.h&gt;<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">typedef int (*MqttTlsCb)(struct _MqttClient* client);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">int MqttClient_NetConnect(<br/></p>
<p class="paragraph_style_4">    MqttClient *client, <br/></p>
<p class="paragraph_style_4">    const char *host,<br/></p>
<p class="paragraph_style_4">    word16 port,<br/></p>
<p class="paragraph_style_4">    int timeout_ms,<br/></p>
<p class="paragraph_style_4">    int use_tls,<br/></p>
<p class="paragraph_style_4">    MqttTlsCb cb);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Description:<br/></p>
<p class="paragraph_style_4">Performs network connect with TLS (if use_tls is non-zero value). Will perform the MqttTlsCb callback if use_tls is non-zero value.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Return Values:<br/></p>
<p class="paragraph_style_4">See enum MqttPacketResponseCodes in /wolfmqtt/mqtt_types.h<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_SUCCESS</span> - Success<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_CONTINUE</span> - Non-blocking mode, perform IO and call again.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Parameters:<br/></p>
<p class="paragraph_style_4"><span class="style_1">client</span> - Pointer to MqttClient structure already initialized using MqttClient_Init.<br/></p>
<p class="paragraph_style_4"><span class="style_1">host</span> - Address of the broker server<br/></p>
<p class="paragraph_style_4"><span class="style_1">port</span> - Optional custom port. If zero will use defaults (1883=normal, 8883=TLS)<br/></p>
<p class="paragraph_style_4"><span class="style_1">use_tls</span> - If non-zero value will connect with and use TLS for encryption of data.<br/></p>
<p class="paragraph_style_4"><span class="style_1">cb</span> - A function callback for configuration of the SSL context certificate checking.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Example:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">#define DEFAULT_CON_TIMEOUT_MS  5000<br/></p>
<p class="paragraph_style_7">#define DEFAULT_MQTT_HOST       &quot;iot.eclipse.org&quot;<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">word16 port = 0;<br/></p>
<p class="paragraph_style_7">const char* host = DEFAULT_MQTT_HOST;<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">static int mqttclient_tls_cb(MqttClient* client)<br/></p>
<p class="paragraph_style_7">{<br/></p>
<p class="paragraph_style_7">    (void)client; /* Supress un-used argument */<br/></p>
<p class="paragraph_style_7">    return SSL_SUCCESS;<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_7"><br/></p>
<p class="paragraph_style_7">/* Connect to broker */<br/></p>
<p class="paragraph_style_7">int rc = MqttClient_NetConnect(&amp;client, host, port, DEFAULT_CON_TIMEOUT_MS, <br/></p>
<p class="paragraph_style_7">    use_tls, mqttclient_tls_cb);<br/></p>
<p class="paragraph_style_7">if (rc != MQTT_CODE_SUCCESS) {<br/></p>
<p class="paragraph_style_7">    printf(&quot;MQTT Net Connect: %s (%d)\n&quot;, MqttClient_ReturnCodeToString(rc), <br/></p>
<p class="paragraph_style_7">rc);<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">See Also:<br/></p>
<p class="paragraph_style_4">MqttClient_NetDisconnect<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">5.11 MqttClient_NetDisconnect<br/></p>
<p class="paragraph_style_5"><br/></p>
<div class="paragraph paragraph_style_4"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfmqtt-manual_files/shapeimage_10.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Synopsis:<br/></p>
<p class="paragraph_style_4">#include &lt;wolfmqtt/mqtt_client.h&gt;<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">int MqttClient_NetDisconnect(<br/></p>
<p class="paragraph_style_4">    MqttClient *client);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Description:<br/></p>
<p class="paragraph_style_4">Performs a network disconnect.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Return Values:<br/></p>
<p class="paragraph_style_4">See enum MqttPacketResponseCodes in /wolfmqtt/mqtt_types.h<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_SUCCESS</span> - Success<br/></p>
<p class="paragraph_style_4"><span class="style_1">MQTT_CODE_CONTINUE</span> - Non-blocking mode, perform IO and call again.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Parameters:<br/></p>
<p class="paragraph_style_4"><span class="style_1">client</span> - Pointer to MqttClient structure already initialized using MqttClient_Init.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Example:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">int rc = MqttClient_NetDisconnect(&amp;client);<br/></p>
<p class="paragraph_style_7">if (rc != MQTT_CODE_SUCCESS) {<br/></p>
<p class="paragraph_style_7">    printf(&quot;MQTT Net Disconnect: %s (%d)\n&quot;, MqttClient_ReturnCodeToString(rc),<br/></p>
<p class="paragraph_style_7">rc);<br/></p>
<p class="paragraph_style_7">}<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">See Also:<br/></p>
<p class="paragraph_style_4">MqttClient_NetConnect<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_5">5.12 MqttClient_ReturnCodeToString<br/></p>
<p class="paragraph_style_5"><br/></p>
<div class="paragraph paragraph_style_4"><div style="height: 1px; width: 693px;  height: 1px; left: 0px; position: relative; top: 1px; width: 693px; " class="tinyText inline-block"><div style="position: relative; width: 693px; "><img src="Docs-wolfmqtt-manual_files/shapeimage_11.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 693px; "/></div></div><br/></div>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Synopsis:<br/></p>
<p class="paragraph_style_4">#include &lt;wolfmqtt/mqtt_client.h&gt;<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4">const char* MqttClient_ReturnCodeToString(<br/></p>
<p class="paragraph_style_4">        int return_code);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Description:<br/></p>
<p class="paragraph_style_4">Performs lookup of a wolfMQTT API return value.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Return Values:<br/></p>
<p class="paragraph_style_4">String representation of the return code.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Parameters:<br/></p>
<p class="paragraph_style_4">return_code - The return value from an API function.<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">Example:<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_7">printf(&quot;Return: %s (%d)\n&quot;, MqttClient_ReturnCodeToString(rc), rc);<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_10">See Also:<br/></p>
<p class="paragraph_style_4">None<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_1">6.0  License<span class="style"><br/></span></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_2">Like wolfSSL (CyaSSL), this package is dual licensed under both the GPLv2 as well as a standard commercial license.  Full license details can be found on the <a title="License.html" href="License.html">wolfSSL Licensing page</a>.  The GPLv2 license header included in the wolfSSL JNI download package is copied below:<br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_4"> * Copyright (C) 2006-2015 wolfSSL Inc.<br/></p>
<p class="paragraph_style_4"> *<br/></p>
<p class="paragraph_style_4"> * This file is part of wolfMQTT.<br/></p>
<p class="paragraph_style_4"> *<br/></p>
<p class="paragraph_style_4"> * wolfSSL is free software; you can redistribute it and/or modify<br/></p>
<p class="paragraph_style_4"> * it under the terms of the GNU General Public.start(); License as published by<br/></p>
<p class="paragraph_style_4"> * the Free Software Foundation; either version 2 of the License, or<br/></p>
<p class="paragraph_style_4"> * (at your option) any later version.<br/></p>
<p class="paragraph_style_4"> *<br/></p>
<p class="paragraph_style_4"> * wolfSSL is distributed in the hope that it will be useful,<br/></p>
<p class="paragraph_style_4"> * but WITHOUT ANY WARRANTY; without even the implied warranty of<br/></p>
<p class="paragraph_style_4"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br/></p>
<p class="paragraph_style_4"> * GNU General Public License for more details.<br/></p>
<p class="paragraph_style_4"> *<br/></p>
<p class="paragraph_style_4"> * You should have received a copy of the GNU General Public License<br/></p>
<p class="paragraph_style_4"> * along with this program; if not, write to the Free Software<br/></p>
<p class="paragraph_style_4"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA<br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_4"><br/></p>
<p class="paragraph_style_1">7.0  Support<span class="style"><br/></span></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_2">Please send questions or comments to wolfSSL at <a title="mailto:support@wolfssl.com" href="https://www.wolfssl.com/cdn-cgi/l/email-protection#86f5f3f6f6e9f4f2c6f1e9eae0f5f5eaa8e5e9eb"><span class="__cf_email__" data-cfemail="21525451514e535561564e4d4752524d0f424e4c">[email&#160;protected]</span><script data-cfhash='f9e31' type="text/javascript">/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */</script></a>.<br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_1">8.0  References<span class="style"><br/></span></p>
<p class="paragraph_style_2"><br/></p>
<p class="paragraph_style_2"><a title="Products-wolfmqtt.html" href="Products-wolfmqtt.html">wolfMQTT Product Page</a><br/></p>
<p class="paragraph_style_2"><a title="Docs.html" href="Docs.html">wolfSSL Documentation</a><br/></p>
<p style="padding-bottom: 0pt; " class="paragraph_style_2"><a title="Docs-wolfssl-manual-toc.html" href="Docs-wolfssl-manual-toc.html">wolfSSL Manual</a></p>
</div>
<div style="clear: both; height: 0px; line-height: 0px; " class="tinyText"> </div>
</div>
</div>
<div id="id3" style="height: 26px; left: 193px; position: absolute; top: 122px; width: 268px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_268_26" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_11"><a class="class1" title="Docs.html" href="Docs.html">Docs</a> <span class="style_2">-&gt;</span> <span class="style_3">wolfMQTT User Manual</span></p>
</div>
</div>
</div>
<div style="height: 1px; width: 698px;  height: 1px; left: 37px; position: absolute; top: 220px; width: 698px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 698px; ">
<img src="Docs-wolfmqtt-manual_files/shapeimage_12.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 698px; "/>
</div>
</div>
<div style="height: 37px; width: 545px;  height: 37px; left: 191px; position: absolute; top: 80px; width: 545px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 545px; ">
<img src="Docs-wolfmqtt-manual_files/shapeimage_13.png" alt="" style="height: 37px; left: 0px; position: absolute; top: 0px; width: 545px; "/>
</div>
</div>
<div id="id4" style="height: 25px; left: 200px; position: absolute; top: 84px; width: 43px; z-index: 1; " class="style_SkipStroke_1 shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_43_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_12"><a class="class2" title="Home.html" href="Home.html">Home</a></p>
</div>
</div>
</div>
<div id="id5" style="height: 25px; left: 365px; position: absolute; top: 84px; width: 72px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_72_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_13"><a class="class3" title="https://wolfssl.com/wolfSSL/download/downloadForm.php" href="https://wolfssl.com/wolfSSL/download/downloadForm.php">Download</a></p>
</div>
</div>
</div>
<div id="id6" style="height: 25px; left: 439px; position: absolute; top: 84px; width: 59px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_59_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_13"><a class="class4" title="License.html" href="License.html">License</a></p>
</div>
</div>
</div>
<div id="id7" style="height: 25px; left: 499px; position: absolute; top: 84px; width: 44px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_44_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_13"><a class="class5" title="Blog/Blog.html" href="Blog/Blog.html">Blog</a></p>
</div>
</div>
</div>
<div id="id8" style="height: 25px; left: 589px; position: absolute; top: 84px; width: 80px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_80_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_13"><a class="class6" title="Community.html" href="Community.html">Community</a></p>
</div>
</div>
</div>
<div style="height: 36px; width: 1px;  height: 36px; left: 245px; position: absolute; top: 81px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfmqtt-manual_files/shapeimage_14.png" alt="" style="height: 36px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div style="height: 37px; width: 1px;  height: 37px; left: 296px; position: absolute; top: 80px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfmqtt-manual_files/shapeimage_15.png" alt="" style="height: 37px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div style="height: 36px; width: 1px;  height: 36px; left: 363px; position: absolute; top: 81px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfmqtt-manual_files/shapeimage_16.png" alt="" style="height: 36px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div style="height: 36px; width: 1px;  height: 36px; left: 438px; position: absolute; top: 81px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfmqtt-manual_files/shapeimage_17.png" alt="" style="height: 36px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div style="height: 37px; width: 1px;  height: 37px; left: 498px; position: absolute; top: 80px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfmqtt-manual_files/shapeimage_18.png" alt="" style="height: 37px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div style="height: 37px; width: 1px;  height: 37px; left: 589px; position: absolute; top: 80px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfmqtt-manual_files/shapeimage_19.png" alt="" style="height: 37px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div id="id9" style="height: 25px; left: 671px; position: absolute; top: 84px; width: 61px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_61_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_13"><a class="class7" title="Contact.html" href="Contact.html">Contact</a></p>
</div>
</div>
</div>
<div id="id10" style="height: 25px; left: 249px; position: absolute; top: 84px; width: 44px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_44_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_12"><a class="class8" title="About.html" href="About.html">About</a></p>
</div>
</div>
</div>
<div style="height: 36px; width: 1px;  height: 36px; left: 670px; position: absolute; top: 81px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfmqtt-manual_files/shapeimage_20.png" alt="" style="height: 36px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div id="id11" style="height: 25px; left: 298px; position: absolute; top: 84px; width: 63px; z-index: 1; " class="style_SkipStroke_1 shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_63_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_13"><a class="class9" title="Products.html" href="Products.html">Products</a></p>
</div>
</div>
</div>
<div id="id12" style="height: 25px; left: 549px; position: absolute; top: 84px; width: 41px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_41_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_12"><a class="class10" title="Docs.html" href="Docs.html">Docs</a></p>
</div>
</div>
</div>
<div style="height: 37px; width: 1px;  height: 37px; left: 545px; position: absolute; top: 80px; width: 0px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 0px; ">
<img src="Docs-wolfmqtt-manual_files/shapeimage_21.png" alt="" style="height: 37px; left: 0px; position: absolute; top: 0px; width: 1px; "/>
</div>
</div>
<div id="id13" style="height: 25px; left: 59px; position: absolute; top: 190px; width: 221px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_221_25" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_14"><a class="class11" title="https://www.wolfssl.com/documentation/wolfMQTT-Manual.pdf" href="https://www.wolfssl.com/documentation/wolfMQTT-Manual.pdf">Download wolfMQTT User Manual (PDF)</a></p>
</div>
</div>
</div>
<div style="height: 22px; width: 22px;  height: 22px; left: 33px; position: absolute; top: 191px; width: 22px; z-index: 1; " class="tinyText style_SkipStroke_2">
<img src="Docs-wolfmqtt-manual_files/PDF.png" alt="" style="border: none; height: 22px; width: 22px; "/>
</div>
<div style="height: 16px; width: 20px;  height: 16px; left: 706px; position: absolute; top: 51px; width: 20px; z-index: 1; " class="tinyText">
<div style="position: relative; width: 20px; ">
<img src="Docs-wolfmqtt-manual_files/shapeimage_22.png" alt="" style="height: 16px; left: 0px; position: absolute; top: 0px; width: 20px; "/>
</div>
</div>
<div style="height: 19px; width: 19px;  height: 19px; left: 707px; position: absolute; top: 25px; width: 19px; z-index: 1; " class="tinyText style_SkipStroke_2">
<img src="Docs-wolfmqtt-manual_files/United%20Kingdom(Great%20Britain).png" alt="" style="border: none; height: 19px; width: 19px; "/>
</div>
<div id="id14" style="height: 23px; left: 328px; position: absolute; top: 48px; width: 258px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_258_23" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_15">Questions? +1 (425) 245-8247</p>
</div>
</div>
</div>
<div style="height: 19px; width: 19px;  height: 19px; left: 685px; position: absolute; top: 25px; width: 19px; z-index: 1; " class="tinyText style_SkipStroke_2">
<a href="http://www.wolfssl.jp/" title="http://www.wolfssl.jp"><img src="Docs-wolfmqtt-manual_files/japan.png" alt="" style="border: none; height: 19px; width: 19px; "/></a>
</div>
<div id="id15" style="height: 28px; left: 593px; position: absolute; top: 44px; width: 119px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_119_28" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_16"><a class="class12" title="https://www.wolfssl.com/forums" href="https://www.wolfssl.com/forums">Support <span class="style_4">Forums</span></a></p>
</div>
</div>
</div>
<div style="height: 121px; width: 155px;  height: 121px; left: 32px; position: absolute; top: 5px; width: 155px; z-index: 1; " class="tinyText style_SkipStroke_2">
<a href="Home.html" title="Home.html"><img src="Docs-wolfmqtt-manual_files/wolfssl_logo.png" alt="" style="border: none; height: 121px; width: 156px; "/></a>
</div>
<div style="height: 17630px; line-height: 17630px; " class="spacer"> </div>
</div>
<div style="height: 100px; margin-left: 0px; position: relative; width: 770px; z-index: 15; " id="footer_layer">
<div style="height: 0px; line-height: 0px; " class="bumper"> </div>
<div id="id16" style="height: 29px; left: 35px; position: absolute; top: 28px; width: 701px; z-index: 1; " class="style_SkipStroke shape-with-text">
<div class="text-content graphic_textbox_layout_style_default_External_701_29" style="padding: 0px; ">
<div class="graphic_textbox_layout_style_default">
<p style="padding-bottom: 0pt; padding-top: 0pt; " class="paragraph_style_17">Copyright 2017 wolfSSL Inc.  All rights reserved.</p>
</div>
</div>
</div>
</div>
</div>
</div>
 <script type="text/javascript">/* <![CDATA[ */(function(d,s,a,i,j,r,l,m,t){try{l=d.getElementsByTagName('a');t=d.createElement('textarea');for(i=0;l.length-i;i++){try{a=l[i].href;s=a.indexOf('/cdn-cgi/l/email-protection');m=a.length;if(a&&s>-1&&m>28){j=28+s;s='';if(j<m){r='0x'+a.substr(j,2)|0;for(j+=2;j<m&&a.charAt(j)!='X';j+=2)s+='%'+('0'+('0x'+a.substr(j,2)^r).toString(16)).slice(-2);j++;s=decodeURIComponent(s)+a.substr(j,m-j)}t.innerHTML=s.replace(/</g,'&lt;').replace(/>/g,'&gt;');l[i].href='mailto:'+t.value}}catch(e){}}}catch(e){}})(document);/* ]]> */</script></body>

<!-- Mirrored from www.wolfssl.com/wolfSSL/Docs-wolfmqtt-manual.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 17 Jan 2017 13:28:26 GMT -->
</html>
